#import "QuestetraBPMAppDelegate.h"
#import "RootViewController.h"


@implementation QuestetraBPMAppDelegate

@synthesize window;
@synthesize navigationController;
@synthesize qbpmClient;


+ (QuestetraBPMAppDelegate *)sharedApp {
	return [[UIApplication sharedApplication] delegate];
}


- (void) handleAuthenticationError {
	UIAlertView* alert = [[UIAlertView alloc] initWithTitle: NSLocalizedString(@"Authentication Error", nil)
													message: NSLocalizedString(@"Authentication error occured. Check your connection settings.", nil)
												   delegate: self
										  cancelButtonTitle: @"OK"
										  otherButtonTitles: nil];
	[alert show];
}

#pragma mark -
#pragma mark Application lifecycle

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    
	qbpmClient = [[QBPMClient alloc] init];

	[window addSubview:navigationController.view];
    [window makeKeyAndVisible];

    return YES;
}


- (void)applicationWillResignActive:(UIApplication *)application {
}


- (void)applicationDidEnterBackground:(UIApplication *)application {
}


- (void)applicationWillEnterForeground:(UIApplication *)application {
}


- (void)applicationDidBecomeActive:(UIApplication *)application {
}


- (void)applicationWillTerminate:(UIApplication *)application {
}


#pragma mark -
#pragma mark Memory management

- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
}


- (void)dealloc {
	[navigationController release];
	[window release];
	[qbpmClient release];
	[super dealloc];
}


@end

